package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


       List<Long> getSetmealIdsByDishIds(List<Long> dishIds);


       void insertBatch(List<SetmealDish> setmealDishes);

    void deleteWithDishBySetmealId(List<Long> ids);

    @Select("select *from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getSetmealDishhBySetmealId(Long setmealId);

    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deletSetmealDishBySetmealId(Long setmealId);

    @Select("select sd.name, sd.copies, d.image, d.description " +
            "from setmeal_dish sd left join dish d on sd.dish_id = d.id " +
            "where sd.setmeal_id = #{setmealId}")
    List<DishItemVO> getDishItemBySetmealId(Long id);
}
